﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelTourism.Data;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace TravelTourism.VariableTemplate
{
    public class VariableTiles : DataTemplateSelector
    {

        public DataTemplate BookingTemplate { get; set; }
        public DataTemplate OffersTemplate { get; set; }
        public DataTemplate LocationBigTemplate { get; set; }
        public DataTemplate LocationSmallTemplate { get; set; }
        public DataTemplate LocationBigTwoItemTemplate { get; set; }
        
    
      

        protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
        {
            FrameworkElement element = container as FrameworkElement;

            if (element!=null && item != null)
            {

                if ((item as SampleDataItem).UniqueId.StartsWith("Booking"))
                    return BookingTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("Offers"))
                    return OffersTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("LocationBig"))
                    return LocationBigTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("LST"))
                    return LocationSmallTemplate;
                if ((item as SampleDataItem).UniqueId.StartsWith("LSB"))
                    return LocationBigTwoItemTemplate; 
            }
            return base.SelectTemplateCore(item, container);
        }

    }
}
